<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:composite="http://xmlns.jcp.org/jsf/composite">

    <h:body>
        <composite:interface>
            <composite:attribute name="bean" required="true"/>
        </composite:interface>

        <composite:implementation>
            <h:form id="languageFilterForm">
                <p:dialog id="languageFilterDialog" header="#{messages.Language}" modal="true" position="top" closable="false" resizable="false" widgetVar="languageFilterDialog">
                    <p:panel id="languageFilterPanel" styleClass="noBorder noPadding noMargin">
                        <p:selectOneButton value="#{cc.attrs.bean.languageOrCollector.importance}" styleClass="width100 marginBottom05em">  
                            <f:selectItem itemLabel="#{messages.Obligatory}" itemValue="#{cc.attrs.bean.obligatory}" />  
                            <f:selectItem itemLabel="#{messages.Important}" itemValue="#{cc.attrs.bean.important}" />  
                            <f:selectItem itemLabel="#{messages.Normal}" itemValue="#{cc.attrs.bean.normal}" />  
                        </p:selectOneButton>

                        <p:selectOneMenu filter="true" filterMatchMode="contains" required="false" requiredMessage="#{messages.LanguageRequired}" converter="#{languageConverter}" id="selectOrLanguage" value="#{cc.attrs.bean.languageOrCollector.language}" effect="fade" label="#{messages.Language}">  
                            <f:selectItem itemLabel="#{messages.Language}" itemValue="" />  
                            <f:selectItems value="#{userResourcesBean.languages}" var="languageOr" itemLabel="#{languageBundle[languageOr.idLanguage.toString()]}" itemValue="#{languageOr}"/>  
                            <p:ajax update="butonAddLanguageOr"/>
                        </p:selectOneMenu>

                        <p:selectOneMenu required="false" requiredMessage="#{messages.LanguageLevelRequired}" converter="#{languageLevelConverter}" id="selectMinimumOrLanguageLevel" value="#{cc.attrs.bean.languageOrCollector.minimumLanguageLevel}" effect="fade" label="#{messages.LanguageLevel}">  
                            <f:selectItem itemLabel="#{messages.LanguageLevel}" itemValue="" />  
                            <f:selectItems value="#{userResourcesBean.languageLevels}" var="minimumOrLanguageLevel" itemLabel="#{languageLevelBundle[minimumOrLanguageLevel.idLanguageLevel.toString()]}" itemValue="#{minimumOrLanguageLevel}"/>  
                            <p:ajax update="butonAddLanguageOr"/>
                        </p:selectOneMenu>

                        <p:selectOneMenu required="false" requiredMessage="#{messages.LanguageLevelRequired}" converter="#{languageLevelConverter}" id="selectMinimumOrSpeakingLanguageLevel" value="#{cc.attrs.bean.languageOrCollector.writingLevel}" effect="fade" label="#{messages.LanguageLevel}">  
                            <f:selectItem itemLabel="#{messages.WritingLevel}" itemValue="" />  
                            <f:selectItems value="#{userResourcesBean.languageLevels}" var="minimumOrLanguageSpeakingLevel" itemLabel="#{languageLevelBundle[minimumOrLanguageSpeakingLevel.idLanguageLevel.toString()]}" itemValue="#{minimumOrLanguageSpeakingLevel}"/>  
                            <p:ajax update="butonAddLanguageOr"/>
                        </p:selectOneMenu>

                        <p:selectOneMenu id="selectOrRequiredVideo" value="#{cc.attrs.bean.languageOrCollector.requiredVideo}" effect="fade" required="false" label="#{messages.RequiredVideo}" requiredMessage="#{messages.RequiredVideo}">  
                            <f:selectItem itemLabel="#{messages.RequiredVideo}" itemValue="" />
                            <f:selectItem itemLabel="#{messages.Yes}" itemValue="#{true}" />
                            <f:selectItem itemLabel="#{messages.No}" itemValue="#{false}" />
                            <p:ajax update="butonAddLanguageOr"/>
                        </p:selectOneMenu>
                        <p:commandButton process="@parent" disabled="#{cc.attrs.bean.languageOrCollector.language==null and cc.attrs.bean.languageOrCollector.minimumLanguageLevel==null and cc.attrs.bean.languageOrCollector.requiredVideo==null and cc.attrs.bean.languageOrCollector.writingLevel==null}" styleClass="blueBackgroundStrong" id="butonAddLanguageOr" value="#{messages.Add}" actionListener="#{cc.attrs.bean.addSearchLanguageInfoRequeriment()}" oncomplete="if (args &amp;&amp; !args.validationFailed){PF('languageFilterDialog').hide();reinitWaypoint();}" update=":createSearchForm:searchPanel :facesPanel :totalFacesForm"/>
                        <p:commandButton value="#{messages.Cancel}" process="@this" styleClass="grayBackgroundStrong" style="margin-left: 3%;" actionListener="#{cc.attrs.bean.reinitSearchLanguageRequeriment()}" update=":createSearchForm:searchPanel :createSearchForm:addFilterPanel" oncomplete="PF('languageFilterDialog').hide();"/>
                    </p:panel>
                </p:dialog>
            </h:form>
        </composite:implementation>
    </h:body>
</html>